﻿using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;

namespace Batman.Gateway
{
    public class Program
    {
        public static void Main(string[] args)
        {
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args)
        {


            var ocelotFile = "Ocelot.json";

            return WebHost.CreateDefaultBuilder(args)
                          .ConfigureAppConfiguration((hostingContext, builder) =>
                          {
                              builder.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
                                     .AddJsonFile(ocelotFile, optional: false, reloadOnChange: true);
                          })
                          .UseStartup<Startup>()
                          .Build();
        }

    }
}
